<div id="content-box">
<div class="content_top" style="height: 4px;"></div>
<br class="clear"/>
<div style="background:#ffffff; width:739px;height:372px;">
<?php
//$vmodel = new VContent();
//$videos = $vmodel->with('contentFiles', 'contentStatus', 'contentType')->findAllByAttributes(array('parent_id'=>67));

$csmodel = new VContentStatus();
$statuses = $csmodel->findAll();
$statusArray = array();

foreach ($statuses as $status)
{
	$statusArray[$status->id] = $status->name;
}

echo "<div class=\"form\">";
//echo CHtml::beginForm('/video/default/changeStatus');
?>


<script type="text/javascript">
  $(document).ready(function(){
    if (!swfobject.hasFlashPlayerVersion("9.0.18")) 
    {
	  alert("Please Install Flash to play videos.");
    }
		
    $(".exemple4").jRating({
	  isDisabled : false,
	  decimalLength: 1,
	  type : 'small',
	  smallStarsPath : '/css/icons/small.png',
	  rateMax : 5,
	  phpPath : '/video/default/vote',
	  onSuccess : function(){
    	window.location.reload();
      }
	});
  });
</script>


<div style="position: relative;">
<div id="showselect" >
<ul>
<li><a href="javascript:;" onclick="toggleChecked('checked','All')">All</a></li>
<li><a href="javascript:;" onclick="toggleChecked('checked','None')">NONE</a></li>
<li style="border-top: 1px solid"><a href="javascript:;" onclick="toggleChecked('checked','Approved')">APPROVED</a></li>
<li><a href="javascript:;" onclick="toggleChecked('checked','Pending')">PENDING</a></li>
<li><a href="javascript:;" onclick="toggleChecked('checked','Rejected')">REJECTED</a></li>
<li><a href="javascript:;" onclick="toggleChecked('checked','New')">NEW</a></li>
</ul>
</div>
</div>


<form id="sortForm" name="sortForm"  method="post" action="">
<script type="text/javascript">

$(document).ready(function() {
	$('input[type="checkbox"][id="select_all"]').change(function() {
		var stat = false;
	    if(this.checked) {
	    	stat = true;
	    }else{
	    	stat = false;
	    }
	    $(".state_check_box").each( function() {
            $(this).attr("checked", stat);
        });
	});
});

function submit_sortForm(status)
{
	document.sortForm.action = "/video/default/index/id/"+status;      
	document.sortForm.submit(); 
}

</script>

<div style="position: relative;">
<div id="showselect1" >
<ul>
<li class="bgnone"><span style="color: #9D8BC3;font-size:17px; cursor:auto; font-weight:bolder; padding:0px 0 0 20px; line-height: 22px;">Filter As</span></li>
<li><input type="checkbox" id="select_all" name="input[status_all]" class="state_check_box" /><a href="/video/default" >All</a></li>
<li><input type="checkbox" name="input[status_new]" class="state_check_box"  /> <a href="/video/default/<?php echo Content::STATUS_NEW; ?>" >NEW</a></li>
<li> <input type="checkbox" name="input[status_pending]" class="state_check_box"  /> <a href="/video/default/<?php echo Content::STATUS_PENDING; ?>" >PENDING</a></li>
<li> <input type="checkbox" name="input[status_approved]" class="state_check_box" /> <a href="/video/default/<?php echo Content::STATUS_APPROVED; ?>" >APPROVED</a></li>
<li> <input type="checkbox" name="input[status_rejected]" class="state_check_box"  /> <a href="/video/default/<?php echo Content::STATUS_REJECTED; ?>" >REJECTED</a></li>
<li> <input type="checkbox" name="input[status_promo]" class="state_check_box"  /> <a href="/video/default/<?php echo Content::STATUS_PROMO; ?>" >PROMO</a></li>
<li class="bgnone"><span style="color: #9D8BC3;font-size:17px; cursor:auto; font-weight:bolder; padding:0px 0 0 20px; line-height: 22px;">Sort By</span></li>
<li><a href="javascript:;" onclick="submit_sortForm(<?php echo Content::ACTION_STATE; ?>)">STATE</a></li>
<li><a href="javascript:;" onclick="submit_sortForm(<?php echo Content::ACTION_VOTES; ?>)">VOTES</a></li>
<li><a href="javascript:;" onclick="submit_sortForm(<?php echo Content::ACTION_STARS; ?>)">STARS</a></li>
</ul>
</div>
</div>
<input type="hidden" name="page" value="page" >
</form>

<div style="position: relative;">
<div id="showselect2" >
<ul>
<li class="bgnone"><span style="color: #9D8BC3;font-size:17px; cursor:auto; font-weight:bolder; padding:0px 0 0 20px; line-height: 22px;">Label as</span></li>
<li><a href="javascript:;" onclick="submit_form(1)">PENDING</a></li>
<li><a href="javascript:;" onclick="submit_form(2)">APPROVED</a></li>
<li><a href="javascript:;" onclick="submit_form(3)">REJECTED</a></li>
<li><a href="javascript:;" onclick="submit_form(4)">NEW</a></li>
<li><a href="javascript:;" onclick="submit_form(5)">PROMO</a></li>
<li class="bgnone"><span style="color: #9D8BC3;font-size:17px; cursor:auto; font-weight:bolder; padding:0px 0 0 20px; line-height: 22px;">Encoding</span></li>
<li><a href="javascript:;" onclick="submit_form(7)">Re-Encode</a></li>
</ul>
</div>
</div>
<div id="top-menu">
 <div class="navBar">

    <ul id="nav-example">
    
    <li id="nav-example-01"><a href="#" onclick="show_select('1');">Select</a></li>
    <li id="nav-example-02"><a original-title="Add" id="north" href="#">Add</a></li>
    <li id="nav-example-03"><a href="javascript:;" original-title="Delete" id="north1" onclick="if(confirm('Are you sure you want to Delete selected videos?'))	submit_form(0);">Delete</a></li>
    <li id="nav-example-04"><a href="#" original-title="Refresh" id="north2">refresh</a></li>
    <li id="nav-example-05"><a href="#" onclick="show_select('2');">Filter</a></li>
    <li id="nav-example-06"><a href="#" onclick="show_select('3');">label</a></li>
    <li id="nav-example-07"><a href="/video/default/list">List</a></li>
    <!-- li id="nav-example-07"><a href="#">Contact</a></li -->
	</ul>
  </div>	
	<!--div id="status">
		<h5>Status</h5>		
<?php 
		echo CHtml::activeDropDownList($csmodel,'id',$statusArray);
//		foreach ($statuses as $model)
//		{
//			echo "<li><a href=\"video/deault/changeStatus/$model->id\">" . $model->name . "</a></li>";
//		}
?>    
    </div-->

  <div class="clear"></div>
</div>

<form id="videoForm" name="videoForm"  method="post" action="">
<script type="text/javascript">

function submit_form(status)
{
	//document.videoForm.submit();
	document.videoForm.action = "/video/default/update?status="+status;      
	document.videoForm.submit(); 
}

function toggleChecked(status,from) {

if(from=='All'){
     $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("input[type=checkbox]").each( function() {
        $(this).attr("checked",status);
    })
    $("#showselect").hide();
}    
if(from=='Pending'){
     $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("input[id='video_Pending[]']").each( function() {
        $(this).attr("checked",status);
    })
    $("#showselect").hide();
}
if(from=='Approved'){
     $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("input[id='video_Approved[]']").each( function() {
        $(this).attr("checked",status);
    })
    $("#showselect").hide();
}
if(from=='Rejected'){
     $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("input[id='video_Rejected[]']").each( function() {
        $(this).attr("checked",status);
    })
    $("#showselect").hide();
}
if(from=='New'){
     $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("input[id='video_New[]']").each( function() {
        $(this).attr("checked",status);
    })
    $("#showselect").hide();
}
if(from=='None'){
    $("input[type=checkbox]").each( function() {
        $(this).attr("checked",false);
    })
    $("#showselect").hide();
}
}

function show_select(id)
{
    if(id==1)
    {
    $("#showselect").toggle();
    $("#showselect1").hide();
    $("#showselect2").hide();
    }
    if(id==2)
    {
    $("#showselect1").toggle();
    $("#showselect").hide();
    $("#showselect2").hide();
    }
    if(id==3)
    {
    $("#showselect2").toggle();
    $("#showselect1").hide();
    $("#showselect").hide();
    }  
}
</script>
 
<?php echo $this->renderPartial('_playerView', array('videos'=>$videos, 'pages' => $pages)); ?>

</div>

